﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using System.Reflection;
using SimpleMVC.Service;


namespace SimpleMVC
{
    public class AutofacConfig
    {
        public static IDependencyResolver GeResolver()
        {
            var builder = new ContainerBuilder();
            Registers(builder);
            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            return new AutofacDependencyResolver(builder.Build());
        }

        private static void Registers(ContainerBuilder builder)
        {
            builder.Register(context => new IocTest()).AsImplementedInterfaces().SingleInstance();
        }
    }
}